package com.example.understand_compose1.fet_jetpack_compose_news.data.posts

import com.example.understand_compose1.fet_jetpack_compose_news.data.model.Post
import com.example.understand_compose1.fet_jetpack_compose_news.data.model.PostsFeed
import kotlinx.coroutines.flow.Flow


// a dao interface for Posts entity
interface PostsDao {
    // 获得指定postId的Post
    suspend fun getPost(postId: String?): Result<Post>
    // 获得所有Posts
    suspend fun getPostsFeed(): Result<PostsFeed>
    // 观察当前favorites
    fun observeFavorites(): Flow<Set<String>>
    // 观察Posts feed
    fun observePostsFeed(): Flow<PostsFeed?>
    // 点击一个Post为favorite或者取消为favorite
    suspend fun toggleFavorite(postId: String)

}